import React, { Component } from 'react'
/* 1. 引入Router的模块 */
import { HashRouter as Router,Route,Switch,Redirect} from "react-router-dom"
import Home from "../Home/Home"
import Category from "../Category/Category"
import Cart from "../Cart/Cart"
import My from "../My/My"
import Chat from '../Chat/Chat'
import Tabbar from "../Tabbar/Tabbar"
import SearchCenter from '../SearchCenter/SearchCenter'
import ProductList from '../ProductList/ProductList'
import GoodDetail from '../GoodDetail/GoodDetail'
export default class PrivateRouter extends Component {
    render() {
        return (
            <div>
                {/* TODO 权限判断 */}
                <Router>
                    <Switch>
                        <Route exact path="/home"  render={(props)=><Tabbar {...props}><Home></Home></Tabbar>}></Route>
                        <Route exact path="/category" render={(props)=><Tabbar {...props}><Category></Category></Tabbar>}></Route>
                        <Route exact path="/cart" render={(props)=><Tabbar {...props}><Cart></Cart></Tabbar>}></Route>
                        <Route exact path="/my" render={(props)=><Tabbar {...props}><My></My></Tabbar>}></Route>
                        <Route exact path="/chat" render={(props)=><Tabbar {...props}><Chat></Chat></Tabbar>}></Route>
                        <Route exact path="/searchCenter" render={(props)=><SearchCenter></SearchCenter>}></Route>
                        <Route exact path="/productList" render={(props)=><ProductList></ProductList>}></Route>
                        <Route exact path="/goodDetail" render={(props)=><GoodDetail></GoodDetail>}></Route>
                        <Redirect to="/home"></Redirect>
                    </Switch>
                </Router>
                
            </div>
        )
    }
}
